﻿
namespace EasyNet.Solr.Commons.Params
{
    /// <summary>
    /// Group parameters.
    /// </summary>
    public struct GroupParams
    {
        public const string GROUP = "group";
        public const string GROUP_QUERY = GROUP + ".query";
        public const string GROUP_FIELD = GROUP + ".field";
        public const string GROUP_SORT = GROUP + ".sort";
        
        /// <summary>
        /// the limit for the number of documents in each group
        /// </summary>
        public const string GROUP_LIMIT = GROUP + ".limit";

        /// <summary>
        /// the offset for the doclist of each group
        /// </summary>
        public const string GROUP_OFFSET = GROUP + ".offset";

        /// <summary>
        /// treat the first group result as the main result.  true/false
        /// </summary>
        public const string GROUP_MAIN = GROUP + ".main";

        /// <summary>
        /// treat the first group result as the main result.  true/false
        /// </summary>
        public const string GROUP_FORMAT = GROUP + ".format";

        /// <summary>
        /// Whether to cache the first pass search (doc ids and score) for the second pass search.
        ///  Also defines the maximum size of the group cache relative to maxdoc in a percentage.
        ///  Values can be a positive integer, from 0 till 100. A value of 0 will disable the group cache.
        ///  The default is 0.
        /// </summary>
        public const string GROUP_CACHE_PERCENTAGE = GROUP + ".cache.percent";

        /// <summary>
        ///  Note: Since you can supply multiple fields to group on, but only have a facets for the whole result. It only makes
        ///  sense to me to support these parameters for the first group.
        ///   Whether the docSet (for example for faceting) should be based on plain documents (a.k.a UNGROUPED) or on the groups (a.k.a GROUPED).
        ///   The docSet will only the most relevant documents per group. It is if you query for everything with group.limit=1
        /// </summary>
        public const string GROUP_TRUNCATE = GROUP + ".truncate";

        /// <summary>
        /// Whether the group count should be included in the response.
        /// </summary>
        public const string GROUP_TOTAL_COUNT = GROUP + ".ngroups";
    }
}
